<template>
  <div >
  <a-card :bordered="false">    
  
    <a-table style="margin:20px" 
     :columns="columnstable" :data-source="data" bordered size="middle"
     @change="pageShow" :loading="tableLoading" :pagination="pagination"
      />

  </a-card>
  </div>
</template>

<script>
import { getStaffCountList } from '@/api/video'
import moment from 'moment'





const data = []
export default {
 
  components: {
   
  },
  data() {
    
    return {
      columnstable,
      data,
      searchData: [],
      current: 1,
      pageSize: 10,
      selectTime: '',
      tableLoading: false,
      queryParam:{},
      pagination: {
        total: 0,
        showTotal: (total) => `共有 ${total} 条数据`,
      },
      
    }
  },
  filters: {
   
  },
 created() {
    this.queryParam.current = this.current
    this.queryParam.pageSize = this.pageSize
  },
  mounted() {
    this.getDataInfoFunction()
  },
  methods: {
   onChange(date, dateString) {
      this.queryParam.startTime = dateString[0] + ' 00:00:00'
      this.queryParam.endTime = dateString[1] + ' 23:59:59'
      this.selectTime = [moment(dateString[0]), moment(dateString[1])]
    },
    //查询
    selectEvent() {
      this.getDataInfoFunction()
    },
    //获取表格数据
    getDataInfoFunction() {
      this.tableLoading = true
      getStaffCountList(this.queryParam)
        .then((response) => {
          const pagination = { ...this.pagination }
          pagination.total = response.data.total
          pagination.pageSize = this.pageSize
          this.pagination = pagination
          this.pagination.current = response.data.current
          this.data = response.data.records
          this.tableLoading = false
        })
        .catch((error) => {
          this.tableLoading = false
        })
    },
    //分页
    pageShow(pagination) {
      this.tableLoading = true
      this.queryParam.current = pagination.current
      this.queryParam.pageSize = pagination.pageSize
      getStaffCountList(this.queryParam)
        .then((response) => {
          const pagination = { ...this.pagination }
          pagination.total = response.data.total
          pagination.pageSize = this.pageSize
          this.pagination = pagination
          this.pagination.current = response.data.current
          this.data = response.data.records
          this.tableLoading = false
        })
        .catch((error) => {
          this.tableLoading = false
        })
    },
    successEvent() {
      this.getDataInfoFunction()
      this.addShow = false
      this.personShow = false
    },
   
  },
}
const columnstable = [
  {
    title: '所属区域',
    dataIndex: 'county',
    width: 100,
    align: 'center',
  },
  {
    title: '关联合同名称',
    dataIndex: 'contractName', 
    width: 100,
    align: 'center',
  },
 
  {
    title: '人员',    
    width: 200,
    align: 'center',
    children: [
      {
      title: '应配',
      dataIndex: 'staffYp',
      width: 100,
      align: 'center',
      },
      {
      title: '实配',
      dataIndex: 'staffSp',
      width: 100,
      align: 'center',
      },

     ]   
  }, 
 
  
  
 
]

</script>
